home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / mail / smailsr2.lha / SMail / src / RCS / map.c,v < prev    next >
Encoding:
Text File  |  1993-11-30  |  2.9 KB  |  148 lines

  1. head    2.1;
  2. access;
  3. symbols
  4.     C_2:2.1
  5.     C_1:1.2;
  6. locks; strict;
  7. comment    @ * @;
  8.  
  9.  
  10. 2.1
  11. date    93.11.23.19.58.39;    author Aussem;    state Exp;
  12. branches;
  13. next    1.2;
  14.  
  15. 1.2
  16. date    93.09.18.16.47.47;    author Aussem;    state Exp;
  17. branches;
  18. next    1.1;
  19.  
  20. 1.1
  21. date    93.09.08.16.27.13;    author Aussem;    state Exp;
  22. branches;
  23. next    ;
  24.  
  25.  
  26. desc
  27. @map an UUCP address
  28. @
  29.  
  30.  
  31. 2.1
  32. log
  33. @Version 2.0 check in
  34. @
  35. text
  36. @/*
  37.  *  map.c
  38.  *
  39.  *  Routines to map an address
  40.  *
  41.  * This program is free software; you can redistribute it and/or
  42.  * modify it under the terms of the GNU General Public License as
  43.  * published by the Free Software Foundation; either version 2 of
  44.  * the License, or (at your option) any later version.
  45.  *
  46.  * This program is distributed in the hope that it will be useful,
  47.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  48.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  49.  * General Public License for more details.
  50.  *
  51.  * You should have received a copy of the GNU General Public License
  52.  * along with this program; if not, write to the Free Software
  53.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  54.  *
  55.  * $Log: map.c,v $
  56.  * Revision 1.2  1993/09/18  16:47:47  Aussem
  57.  * insert GNU license text in the header
  58.  *
  59.  * Revision 1.1  1993/09/08  16:27:13  Aussem
  60.  * Initial revision
  61.  *
  62.  *
  63.  */
  64.  
  65. static char     *rcsid="$Id: map.c,v 1.2 1993/09/18 16:47:47 Aussem Exp Aussem $";
  66.  
  67. # include    <stdio.h>
  68. # include    <sys/types.h>
  69. # include    "defs.h"
  70.  
  71. extern int queuecost;
  72.  
  73. /*
  74. **
  75. **  map(): map addresses into <host, user, form, cost> sets.
  76. **
  77. **  Calls resolve() for each address of argv.  The result is hostv and
  78. **  userv arrays (pointing into buffers userz and hostz), and formv array.
  79. **
  80. */
  81.  
  82. map(argc, argv, hostv, userv, formv, costv)
  83. int argc;                /* address count         */
  84. char **argv;                /* address vector         */
  85. char *hostv[];                /* remote host vector         */
  86. char *userv[];                /* user name vector         */
  87. enum eform formv[];            /* address format vector     */
  88. int costv[];                /* cost vector             */
  89. {
  90.     int i, cost;
  91.     enum eform resolve();
  92.     char *c;
  93.     static char userbuf[BIGBUF], *userz;
  94.     static char hostbuf[BIGBUF], *hostz;
  95.  
  96.     userz = userbuf;
  97.     hostz = hostbuf;
  98.  
  99.     for( i=0; i<argc; i++ ) {
  100. #ifdef DEFQUEUE
  101.         cost = queuecost+1;        /* default is queueing */
  102. #else
  103.         cost = queuecost-1;        /* default is no queueing */
  104. #endif
  105.         userv[i] = userz;        /* put results here */
  106.         hostv[i] = hostz;
  107.         if ( **argv == '(' ) {        /* strip () */
  108.             ++*argv;
  109.             c = index( *argv, ')' );
  110.             if (c)
  111.                 *c = '\0';
  112.         }
  113.                         /* here it comes! */
  114.         formv[i] = resolve(*argv++, hostz, userz, &cost);
  115.         costv[i] = cost;
  116.         userz += strlen( userz ) + 1;    /* skip past \0 */
  117.         hostz += strlen( hostz ) + 1;
  118.     }
  119. }
  120. @
  121.  
  122.  
  123. 1.2
  124. log
  125. @insert GNU license text in the header
  126. @
  127. text
  128. @d21 3
  129. d30 1
  130. a30 1
  131. static char     *rcsid="$Id: map.c,v 1.1 1993/09/08 16:27:13 Aussem Exp Aussem $";
  132. @
  133.  
  134.  
  135. 1.1
  136. log
  137. @Initial revision
  138. @
  139. text
  140. @d6 4
  141. a9 1
  142.  * $Log$
  143. d11 14
  144. d27 1
  145. a27 1
  146. static char     *rcsid="$Id$";
  147. @
  148.